package com.quasar.hpatient.view.fragment;
import android.support.v4.view.ViewPager;
import android.widget.TextView;

import com.quasar.hpatient.R;
import com.quasar.hpatient.base.BaseFragment;
import com.quasar.hpatient.view.adapter.MyPagerAdapter;
import com.quasar.hpatient.view.community.PostActivity_;
import com.quasar.hpatient.view.personal.collection.FriendsCircleFragment_;
import com.quasar.hpatient.view.personal.collection.RecommendFragment_;
import com.quasar.hpatient.widget.WechatTab;

import org.androidannotations.annotations.AfterViews;
import org.androidannotations.annotations.Click;
import org.androidannotations.annotations.EFragment;
import org.androidannotations.annotations.OptionsItem;
import org.androidannotations.annotations.OptionsMenu;
import org.androidannotations.annotations.ViewById;
import org.androidannotations.annotations.res.StringArrayRes;

/**
 * author : 许建宏
 * Date: 2017/9/29 0029
 * View:社区
 */

@OptionsMenu(R.menu.menu_bbs)
@EFragment(R.layout.fragment_community)
public class CommunityFragment extends BaseFragment {

    private MyPagerAdapter adapter;

    @StringArrayRes
    String [] record_title;
    @ViewById(R.id.pagerFragmentProgram)
    ViewPager pagerFragmentProgram;

    @ViewById(R.id.tabs)
    WechatTab tabs;
    @ViewById(R.id.iv_right)
    TextView iv_right;

    @AfterViews
    void init(){
        initView();
        initData();
    }

    @OptionsItem(R.id.action_search)
    public void action_search() {

    }

    //发帖
    @Click(R.id.ll_right)
    public void ll_right(){
        PostActivity_.intent(getActivity()).start();
    }

    @Override
    public void initView() {
        iv_right.setText("发帖");
        adapter=new MyPagerAdapter(getChildFragmentManager());
        adapter.add(record_title[0],new FriendsCircleFragment_());
        adapter.add(record_title[1],new RecommendFragment_());
        pagerFragmentProgram.setAdapter(adapter);
        pagerFragmentProgram.setPageMargin(10);
        tabs.setViewPager(pagerFragmentProgram);
    }

    @Override
    public void initData() {

    }
}
